refactor(codegen): make Statement::Gen code more compact#10937
Conversation
To improve instructions cache. relates #10931
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the code generation for various Statement variants to use a more compact syntax, aiming to improve the instructions cache.
- Removed repetitive calls to p.print_statement_comments in many Statement match arms.
- Streamlined multiple implementations to use a single-line expression where possible.
Comments suppressed due to low confidence (2)
crates/oxc_codegen/src/gen.rs:171
- [nitpick] The ordering of p.print_statement_comments and p.print_indent for TS declarations has been changed compared to other Statement variants. Verify that printing the comments after indenting does not undesirably affect the output formatting.
Self::TSInterfaceDeclaration(decl) => { p.print_indent(); p.print_statement_comments(decl.span.start); ...
crates/oxc_codegen/src/gen.rs:114
- The refactoring removes the call to p.print_statement_comments for several Statement variants (e.g. BreakStatement, ContinueStatement, etc.). Ensure that comments are still printed as intended, either by virtue of the delegated stmt.print(p, ctx) or by other means.
Self::BreakStatement(stmt) => stmt.print(p, ctx),
CodSpeed Instrumentation Performance ReportMerging #10937 will not alter performanceComparing Summary
|

To improve instructions cache.
relates #10931